package com.ms.auction.goods.ctrl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ms.auction.common.module.goods.com.FieldRet;
import com.ms.auction.common.module.goods.com.HomeReceive;
import com.ms.auction.common.module.goods.com.ProceeTre;
import com.ms.auction.goods.feign.IAuctionGoodsService;
import com.ms.auction.utils.respons.Result;
import com.ms.auction.utils.respons.ResultBuilder;
import com.ms.auction.utils.tools.Paging;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 专场 前端控制器
 * </p>
 *
 * @author MaHC
 * @since 2019-07-12
 */
@RestController
@RequestMapping("/auctionField")
public class AuctionFieldController {
    @Resource
    private IAuctionGoodsService iAuctionGoodsService;

    /**
     * 查询所有拍场
     *
     * @param paging
     * @author MaHC
     * @return
     */
    @PostMapping("/getAuctionField")
    public Result getAuctionField(@RequestBody Paging paging){
        List<FieldRet> auctionField = iAuctionGoodsService.getAuctionField(paging);
        return ResultBuilder.success(auctionField);
    }

    /**
     * 查询某个拍场中的拍品
     *
     * @param homeReceive
     * @author MaHC
     * @return
     */
    @PostMapping("/getAuctionFieldOfGoods")
    public Result getAuctionFieldOfGoods(@RequestBody HomeReceive homeReceive){
        if (homeReceive.getFieldId()==null){
            return ResultBuilder.errorInfo("参数错误");
        }
        List<ProceeTre> auctionField = iAuctionGoodsService.getAuctionFieldOfGoods(homeReceive);
        return ResultBuilder.success(auctionField);
    }

}
